SET(TARGET_NAME LibReflection)
#PROJECT(${TARGET_NAME})
#必须要有的宏定义
ADD_DEFINITIONS (-DLIB_REFLECTION_EXPORT)
# ADD_DEFINITIONS (-DUSE_QT_BASIC)
#使用gl3
#ADD_DEFINITIONS(-DOSG_GL3_AVAILABLE)

#INCLUDE_DIRECTORIES("..\\..\\include")
#LINK_DIRECTORIES("..\\..\\lib")
IF (CMAKE_CL_64)
ELSE()
ENDIF()
	# INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include)
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME})
	# INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/LibVrpn)
    INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/LibCommon)
	LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/lib)
    LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/LibCommon)
	
	# include_directories(${OSG_DIR}/include)
	# link_directories(${OSG_DIR}/lib)

    # INCLUDE_DIRECTORIES(${SPDLOG_INCLUDE_DIR})
    # LINK_DIRECTORIES(${SPDLOG_LIB_DIR})

    # include_directories(${QT_INCLUDE_DIR})
	# link_directories(${QT_LIB_DIR})
	
    # INCLUDE_DIRECTORIES(${RTTR_INCLUDE_DIR})
    # LINK_DIRECTORIES(${RTTR_LIB_DIR})

    INCLUDE_DIRECTORIES(${CLANG_INCLUDE_DIR})
    LINK_DIRECTORIES(${CLANG_LIB_DIR})

    # INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
    # INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR}/QtCore)
	# link_directories(${QT_LIB_DIR})
	#INCLUDE_DIRECTORIES( ${QT_DIR}/include)
	#INCLUDE_DIRECTORIES( ${QT_DIR}/include/QtCore)
	#LINK_DIRECTORIES( ${QT_DIR}/lib)
#库文件在debug下名字后面加d
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
#ADD_DEFINITIONS (${Qt5Widgets_DEFINITIONS})

FILE(GLOB_RECURSE ThisTarget_INCLUDE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.h")
FILE(GLOB_RECURSE ThisTarget_SRC_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.cpp")

source_group("include" FILES ${ThisTarget_INCLUDE_LIST})
source_group("src" FILES ${ThisTarget_SRC_LIST})

#ADD_EXECUTABLE(${TARGET_NAME} ${ThisTarget_SRC_LIST} ${ThisTarget_INCLUDE_LIST} )
ADD_LIBRARY(${TARGET_NAME} SHARED ${ThisTarget_SRC_LIST} ${ThisTarget_INCLUDE_LIST})

add_dependencies(${TARGET_NAME} LibCommon)

IF (UNIX)
    SET(ADDITIONAL_LIBRARIES_RELEASE
        # Qt5Core
        clang
        LibCommon
        )

    SET(ADDITIONAL_LIBRARIES_DEBUG
        # Qt5Cored
        clang
        LibCommond
        )
ELSEIF(WIN32)
    SET(ADDITIONAL_LIBRARIES_RELEASE
        # Qt5Core
        libClang
        LibCommon
        )

    SET(ADDITIONAL_LIBRARIES_DEBUG
        # Qt5Cored
        libClang
        LibCommond
        )
ELSE()
ENDIF()


TARGET_LINK_LIBRARIES(${TARGET_NAME} PRIVATE debug "${ADDITIONAL_LIBRARIES_DEBUG}" PRIVATE optimized "${ADDITIONAL_LIBRARIES_RELEASE}")
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PROJECT_BINARY_DIR}/bin)

#set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE /ENTRY:mainCRTStartup")# WINDOWS

set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/lib)
set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/lib)

